﻿using UnityEngine;
public static class GlobalMembersGame_config
{

    //* 初始化游戏键位设置 
    // ****************************************************************************
    // * Punch And Kick -- a simple 2D Fighting Game.
    // *
    // * Copyright (C) 2013 by
    // * Liu Chao
    // *
    // * This file is part of the Punch And Kick project, and may only be used,
    // * modified, and distributed under the terms of the GPLv2.
    // *
    // * (GPLv2 is abbreviation of GNU General Public License Version 2)
    // *
    // * By continuing to use, modify, or distribute this file you indicate that you
    // * have read the license and understand and accept it fully.
    // *
    // * The Punch And Kick project is distributed in the hope that it will be
    // * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 
    // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GPL v2 for
    // * more details.
    // *
    // * You should have received a copy of the GPLv2 along with this file. It is
    // * usually in the LICENSE.TXT file, If not, see <http://www.gnu.org/licenses/>.
    // * **************************************************************************

    // ****************************************************************************
    // * Punch And Kick -- 一个普通的2D格斗游戏
    // *
    // * 版权所有 (C) 2013 归属于
    // * 刘超
    // *
    // * 这个文件是 Punch And Kick 项目的一部分，并且只可以根据GPLv2许可协议来使用、
    // * 更改和发布。
    // *
    // * (GPLv2 是 GNU通用公共许可证第二版 的英文缩写)
    // *
    // * 继续使用、修改或发布本文件，表明您已经阅读并完全理解和接受这个许可协议。
    // *
    // * Punch And Kick 项目是基于技术交流目的而加以散布的，但不负任何担保责任，例
    // * 如：稳定性、可玩性、趣味性等的担保，甚至没有适销性或特定用途的隐含担保，详
    // * 情请参照GPLv2许可协议。
    // *
    // * 您应已收到附随于本文件的GPLv2许可协议的副本，它通常在LICENSE.TXT文件中，如果
    // * 没有，请查看：<http://www.gnu.org/licenses/>.
    // * **************************************************************************


    // ****************************************************************************
    // * Punch And Kick -- a simple 2D Fighting Game.
    // *
    // * Copyright (C) 2013 by
    // * Liu Chao
    // *
    // * This file is part of the Punch And Kick project, and may only be used,
    // * modified, and distributed under the terms of the GPLv2.
    // *
    // * (GPLv2 is abbreviation of GNU General Public License Version 2)
    // *
    // * By continuing to use, modify, or distribute this file you indicate that you
    // * have read the license and understand and accept it fully.
    // *
    // * The Punch And Kick project is distributed in the hope that it will be
    // * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 
    // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GPL v2 for
    // * more details.
    // *
    // * You should have received a copy of the GPLv2 along with this file. It is
    // * usually in the LICENSE.TXT file, If not, see <http://www.gnu.org/licenses/>.
    // * **************************************************************************

    // ****************************************************************************
    // * Punch And Kick -- 一个普通的2D格斗游戏
    // *
    // * 版权所有 (C) 2013 归属于
    // * 刘超
    // *
    // * 这个文件是 Punch And Kick 项目的一部分，并且只可以根据GPLv2许可协议来使用、
    // * 更改和发布。
    // *
    // * (GPLv2 是 GNU通用公共许可证第二版 的英文缩写)
    // *
    // * 继续使用、修改或发布本文件，表明您已经阅读并完全理解和接受这个许可协议。
    // *
    // * Punch And Kick 项目是基于技术交流目的而加以散布的，但不负任何担保责任，例
    // * 如：稳定性、可玩性、趣味性等的担保，甚至没有适销性或特定用途的隐含担保，详
    // * 情请参照GPLv2许可协议。
    // *
    // * 您应已收到附随于本文件的GPLv2许可协议的副本，它通常在LICENSE.TXT文件中，如果
    // * 没有，请查看：<http://www.gnu.org/licenses/>.
    // * **************************************************************************






    //* 初始化游戏键位设置 
    public static void GameConfig_InitKeyControl()
    {
        if (UnityEngine.Application.platform == UnityEngine.RuntimePlatform.PSP2)
        {
            game_config.control_key.a_attack = (int)KeyCode .Joystick1Button3;
            game_config.control_key.b_attack = (int)KeyCode.Joystick1Button2;
            game_config.control_key.defense = (int)KeyCode.Joystick1Button1;
            game_config.control_key.jump = (int)KeyCode.Joystick1Button0;
            game_config.control_key.left = (int)KeyCode.Joystick1Button11;
            game_config.control_key.right = (int)KeyCode.Joystick1Button9;
            game_config.control_key.up = (int)KeyCode.Joystick1Button8;
            game_config.control_key.down = (int)KeyCode.Joystick1Button10;
        }
        else if (UnityEngine.Application.platform == UnityEngine.RuntimePlatform.WindowsEditor)
        {
            game_config.control_key.a_attack = (int)DefineConstantsGame_config.LCUIKEY_J;
            game_config.control_key.b_attack = (int)DefineConstantsGame_config.LCUIKEY_K;
            game_config.control_key.defense = (int)DefineConstantsGame_config.LCUIKEY_L;
            game_config.control_key.jump = (int)DefineConstantsGame_config.LCUIKEY_SPACE;
            game_config.control_key.left = (int)DefineConstantsGame_config.LCUIKEY_A;
            game_config.control_key.right = (int)DefineConstantsGame_config.LCUIKEY_D;
            game_config.control_key.up = (int)DefineConstantsGame_config.LCUIKEY_W;
            game_config.control_key.down = (int)DefineConstantsGame_config.LCUIKEY_S;
        }
        else
        {
            game_config.control_key.a_attack = (int)KeyCode.Joystick1Button3;
            game_config.control_key.b_attack = (int)KeyCode.Joystick1Button2;
            game_config.control_key.defense = (int)KeyCode.Joystick1Button1;
            game_config.control_key.jump = (int)KeyCode.Joystick1Button0;
            game_config.control_key.left = (int)KeyCode.Joystick1Button11;
            game_config.control_key.right = (int)KeyCode.Joystick1Button9;
            game_config.control_key.up = (int)KeyCode.Joystick1Button8;
            game_config.control_key.down = (int)KeyCode.Joystick1Button10;
        }
    }

    ////* 获取键位配置 

    //	//* 获取键位配置 
    public static void GameConfig_GetKeyControl(out ControlKey_ buff)
    {
        buff = game_config.control_key;
    }

    ////* 设置键位配置 

    //	//* 设置键位配置 
    //	public static void GameConfig_SetKeyControl(ControlKey_ buff)
    //	{
    //		game_config.control_key = buff;
    //	}

    ////* 初始化游戏配置 

    //	//* 初始化游戏配置 
    public static void GameConfig_Init()
    {
        game_config.windowed = DefineConstantsGame_config.TRUE;
        GameConfig_InitKeyControl();
    }

    ////* 载入游戏配置 

    //	//* 载入游戏配置 
    //	public static void GameConfig_Load()
    //	{
    //		FILE fp;
    //		fp = fopen(DefineConstantsGame_config.CONFIG_FILE, "rb");
    //		if (fp == null)
    //		{
    //			return;
    //		}
    //		fread(game_config, typeof(game_config), 1, fp);
    //		fclose(fp);
    //	}

    ////* 保存游戏配置 

    //	//* 保存游戏配置 
    //	public static void GameConfig_Save()
    //	{
    //		FILE fp;
    //		fp = fopen(DefineConstantsGame_config.CONFIG_FILE, "wb+");
    //		if (fp == null)
    //		{
    //			return;
    //		}
    //		fwrite(game_config, typeof(game_config), 1, fp);
    //		fclose(fp);
    //	}

    //* 配置游戏是否以窗口模式运行 

    //* 配置游戏是否以窗口模式运行 
    public static void GameConfig_SetWindowed(LCUI_BOOL flag)
	{
		game_config.windowed = flag;
	}

//* 判断游戏是否要以窗口模式运行 

	//* 判断游戏是否要以窗口模式运行 
	public static LCUI_BOOL GameConfig_IsWindowed()
	{
		return game_config.windowed;
	}

	////#endif
	public static GameConfigData game_config = new GameConfigData();
}




public class GameConfigData
{
	public LCUI_BOOL windowed = new LCUI_BOOL();
	public ControlKey_ control_key = new ControlKey_();
}
